/**
 * 
 */
package hu.cubussapiens.client.banking.accounts;

import org.w3c.dom.Element;

import hu.cubussapiens.client.banking.GeneralContants;
import hu.cubussapiens.client.core.query.AbstractQueryGenerator;

/**
 * @author balage
 *
 */
public class CreateAccount extends AbstractQueryGenerator {

	final String id;
	final String name;
	final Long access;
	
	/**
	 * 
	 */
	public CreateAccount(String id, String name, Long access) {
		this.id = id;
		this.name = name;
		this.access = access;
	}

	/* (non-Javadoc)
	 * @see hu.cubussapiens.client.core.query.AbstractQueryGenerator#generateQuery()
	 */
	@Override
	protected Element generateQuery() {
		return or(
				construct(
						createLiteral(id, access), 
						createLiteral(GeneralContants.PROPERTY_INSTANCEOF), 
						createLiteral(AccountConstants.CLASS_ACCOUNT)
					),
				construct(
						createLiteral(id, access), 
						createLiteral(GeneralContants.PROPERTY_NAME), 
						createLiteral(name, access)
					)
				);
	}

}
